package com.eshop.dao;

import com.eshop.pojo.AdminInfo;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;


public interface AdminInfoDao {
        @Select("select * from admin_info where name=#{name} and pwd=#{pwd}")
    AdminInfo selectByNameAndPwd(AdminInfo admin);//根据用户名密码查询管理员

        @Select("select * from admin_info where id=#{id}")
        @Results({
                @Result(property = "functions" ,column = "id",
                        many = @Many(select = "com.eshop.dao.FunctionDao.selectFunctionsByAid",fetchType = FetchType.EAGER))
        })
    AdminInfo selectById(Integer id);//根据管理员编号，获取管理员对象及其权限
}
